<template>
  <div>
    <h1>Vuex</h1>
    <p>{{ $store.state.age }}</p>
    <p>{{ $store.getters.abc }}</p>
    <button @click="$store.commit('updateAge', 1)">调用mutations方法</button>
    <button @click="$store.dispatch('updateAgeAfter1s', 2)">
      调用actions方法
    </button>
    <button @click="$store.state.age--">尝试修改state数据</button>
    <my-test></my-test>
  </div>
</template>

<script>
import MyTest from './components/MyTest.vue'
export default {
  components: { MyTest }
}
</script>

<style scoped></style>
